//
//  XSAVTools.h
//  AudioVideo
//
//  Created by xueshan1 on 2019/8/23.
//  Copyright © 2019 xueshan1. All rights reserved.
//

#import <Foundation/Foundation.h>

 @class XSPhotoModel;
@interface XSAVTools : NSObject

+ (instancetype)shareInstance;

//计算video大小
+ (CGFloat)calculateVideoSizeWithFilename:(NSString *)filename;
 
//生成缩略图  一张
+ (UIImage *)getThumbnailImageFromFilePath:(NSString *)videoPath time:(NSTimeInterval )videoTime isLocal:(BOOL)isLocal;
//生成缩略图  多张
+ (void)generateThumbnailsWithURL:(NSURL *)url  orAsset:(AVAsset *)asset completionHandler:(void(^)(CMTime requestedTime, CGImageRef  _Nullable image, CMTime actualTime, AVAssetImageGeneratorResult result, NSError * _Nullable error, NSInteger imageCount))completionHandler;

#pragma mark - synthesize final
+ (void)systhesizeVideoWithOriginURL:(NSURL *)originURL  orAsset:(AVAsset *)asset addCustomAudio:(NSURL *)addCustomAudioURL waterImage:(UIImage *)waterImage exportPath:(NSString *)exportPath completionHandler:(void(^)(int status,NSString *errorMsg, NSURL*exportURL))completionHandler;

#pragma mark - merge videos
+ (AVMutableComposition *)mergeVideos:(NSArray<XSPhotoModel *>*)array complete:(void(^)(int status,NSString *errorMsg, NSURL * mergeFinishVideoURL))complete;

//export
+ (void)exportVideoWithComposition:(AVMutableComposition *)mixCompostion
                   videoCompostion:(AVMutableVideoComposition *)videoComposition
                         exportURL:(NSURL *)exportURL
                          complete:(void(^)(int status,NSString *errorMsg, NSURL * mergeFinishVideoURL))completionHandler;


@end

